import http from "@/utils/http"

const enableAllocation = `/applet/Service/enableAllocation` // 接收任务 
const refuesAllocation =  `/applet/Service/refuesAllocation` // 拒绝任务 
const cancelAllocation = `/applet/Service/cancelAllocation` // 作废任务
const selectDriverNoOverBill = `/applet/Service/getAllocation` //查询司机任务

/**
 * 根据司机id获取司机正在进行的任务
 * @param {司机id} driverId 
 */
export const getDriverTask = (driverId,status) => {
  return http.post(selectDriverNoOverBill, {driverId:driverId,status:status})
}

/**
 * 接收任务
 * @param {任务单号} planAllocationCode 
 */
export const handleConfirm = (planAllocationCode) => {
  return http.post(enableAllocation,{planAllocationCode:planAllocationCode})
}

/**
 * 拒绝任务
 * @param {任务单号} planAllocationCode 
 */
export const handleRefuse = (planAllocationCode) => {
  return http.post(refuesAllocation,{planAllocationCode:planAllocationCode})
}

/**
 * 作废任务
 * @param {任务单号 } planAllocationCode 
 */
export const handleCancel = (planAllocationCode) => {
  return http.post(cancelAllocation,{planAllocationCode:planAllocationCode})
}


